<%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*,java.util.Random"%>
<%	
String userr="";
userr = (session.getAttribute("userr")==null) ? "Null" : (String)session.getAttribute("userr"); 

if(userr.equals("Null"))
{
	session.invalidate();
	%>
	<!--<H5 align=center><IMG SRC="Images/error.gif" WIDTH="17" HEIGHT="13" BORDER=0 ALT="">Session time out...Please login again</H5>-->
	<script language=javascript>
		location.replace('sessiontimeout.html');
	</script>
	<% 
}
else{
%>
<HEAD>
  <script LANGUAGE="Javascript" SRC="Images/validate.js"></script>
  <LINK href="styles.css" type="text/css" rel="stylesheet">
  <script LANGUAGE="Javascript" SRC="Images/calender.js"></script>
  <script LANGUAGE="Javascript" SRC="">
	function ChkMandatoryField(F,T){
			var val= F.value;
			if(val==""){alert(T+" is mandatory");return false;}
	}
	function ChkNumField(F,T){
			var val = F.value;
			if(isNaN(val)==true||val==""){alert("Please enter numbers for "+T);return false;}
	}
	function validate()
	{
		var frm = document.forms(0);
	    if(ChkMandatoryField(frm.Title,'Title')==false) return false;
		if(ChkMandatoryField(frm.Date,'Date')==false) return false;
		if(ChkMandatoryField(frm.Category,'Category')==false) return false;
		if(ChkMandatoryField(frm.Description,'Description')==false) return false;
		if(ChkMandatoryField(frm.Contributor,'Contributor')==false) return false;
		//if(ChkMandatoryField(frm.FilePath,'File')==false) return false;
		if(document.getElementById("infodiv").innerHTML==""){
			alert("Please Attach a file to continue");
			return false;
		}

	}
	function fnUpload()
	{
		var CatObj = document.forms(0).Category;
		var Category = CatObj.options[CatObj.options.selectedIndex].value;
		
		fnEmpPopUp('Uploads2.jsp?Category='+Category,80,400);
	}

</script>
</HEAD>
<Body class=Grad>
<H2 align=center>Upload Content</H2>
<FORM ACTION="Uploads1.jsp" onsubmit="return validate()" >
<TABLE align=center width="50%" align=center>
	<TR class=row_odd>
		<TH align=left>User</TH>
		<TD><Input type=text class=ReadOnlyTextField  name='userid' value='<%=userr%>' readonly></TD>
	</TR>
	<TR class=row_even>
		<TH align=left>Title<FONT COLOR="red">*</Font></TH>
		<TD><Input type=text class=TextField  name='Title' value=''></TD>
	</TR>
	<TR class=row_odd>
		<TH align=left>Date<FONT COLOR="red">*</FONT></TH>
		<TD><Input type=text class=TextField  name='Date' value=''>
			<img onkeypress="fnCalendar(this)" id="imgDate" style="CURSOR: hand" onClick="fnCalendar(this)" height="16" src="Images/CalDis.gif" width="16" border="0" name="imgDate" onMouseOver="fnEnableCalLookup(this)" onMouseOut="fnDisableCalLookup(this)" ></TD>
   </TR>
	<TR class=row_even>
	    <TH align=left>Category<FONT COLOR="red">*</FONT></TH>
		<TD><INPUT TYPE="Hidden" NAME="SelCategory" value="SampleResumes">
			<select name=Category class="ListBox" onchange="document.forms(0).SelCategory.value=this.value">
			<option value=SampleResumes selected>SampleResumes</option>
			<option value=CoverLetters>CoverLetters</option>
			<option value=PlacementPapers>PlacementPapers</option>
			<option value=FAQs>FAQs</option>
			<option value=Tutors>Tutors</option>
			<option value=Information>Information</option>
		</select></TD>
	</TR>
	<TR class=row_odd>
		<TH align=left>Description<FONT COLOR="red">*</FONT></TH>
		<TD><textarea name="Description" class=TextField></textarea></TD>
	</TR>
	<TR class=row_even>
		<TH align=left>Contributor<FONT COLOR="red">*</FONT></TH>
		<TD><Input type=text class=TextField  name='Contributor' value=''></TD>
	</TR>
	<TR class=row_odd>
		<TH align=left>File<FONT COLOR="red">*</FONT></TH>
		<TD><div id="infodiv"></div><Input type=hidden name='FilePath' class= "TextField"><INPUT id="FUBtn" name="FUBtn" class= "UploadButton" TYPE="Button" value='Attach File' onclick="fnUpload()" class="UploadButton"></TD>
	</TR>
	<TR><TH align=left><INPUT class= Button TYPE="submit" value='Upload'></TH><TH align=left><INPUT class= Button  TYPE="reset" value='Clear'></TH></TR>
</FORM>

</TABLE>

		<H6 align=center>Fields with <FONT SIZE="" COLOR="red">*</FONT> are mandatory </H6>


</BODY>
<%
}
%>